#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2019/2/18 14:53
@desc
"""

import os
import time
from threading import Thread
from multiprocessing import Process


def func(n):
    n + 1


if __name__ == '__main__':
    start = time.time()
    t_lst = []
    for i in range(100):
        t = Thread(target=func, args=(i,))
        t.start()
        t_lst.append(t)
    for t in t_lst:
        t.join()
    t1 = time.time() - start

    start = time.time()
    t_lst = []
    for i in range(100):
        t = Process(target=func, args=(i,))
        t.start()
        t_lst.append(t)
    for t in t_lst:
        t.join()
    t2 = time.time() - start

    # (0.04999995231628418, 16.68499994277954)
    print(t1, t2)
